/*
 * Copyright 2008 Nathan C Jones
 * 
 * This file is part of Fivehundred.
 * 
 * Fivehundred is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * Fivehundred is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * Fivehundred. If not, see <http://www.gnu.org/licenses/>. 
 */

package com.googlecode.fivehundred.ui;

import java.awt.Color;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import com.googlecode.fivehundred.model.Card;
import com.googlecode.fivehundred.model.CardPile;
import com.googlecode.fivehundred.model.Deck;
import com.googlecode.fivehundred.model.Hand;

public class CardGraphicsDemo {

	private static final Hand HAND = new Hand();

	private static final int HAND_SIZE = 10;
	static {
		final CardPile pile = new CardPile();
		for (final Card c : Deck.FIVE_HUNDRED_DECK) {
			pile.add(c);
		}
		pile.shuffle();
		for (int i = 0; i < HAND_SIZE; i++) {
			HAND.add(pile.removeTop());
		}
	}

	/**
	 * @param args
	 */
	public static void main(final String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				createAndShowGUI();
			}
		});
	}

	private static void createAndShowGUI() {
		final JFrame frame = new JFrame("Card Selection Demo");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		frame.setSize(640, 400);
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);

		final Container contentPane = frame.getContentPane();
		final GraphicalHand gHand = new GraphicalHand(HAND, 150, true);
		gHand.setPosition(200, 150);
		// gHand.setAngle(Math.PI/2);
		final GraphicsCanvas canvas = new GraphicsCanvas(gHand);
		canvas.setOpaque(true);
		canvas.setBackground(new Color(0, 128, 0));
		contentPane.add(canvas);
	}

}
